import sys

def is_leap_year(year):
  return (year % 4 == 0 and year % 100 != 0) or (year % 4 == 0 and year % 400 == 0)

N = input("Input the end year:")

month_index = 0
dow = 5 # 1900-1-13 SAT

year = 1900
end_year = year + int(N)

week_stat = [0] * 7 # MON ~ SUN

#      JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC
days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

while year < end_year:
  while month_index < 12:
    week_stat[dow] += 1

    dow += days[month_index]

    if is_leap_year(year) and month_index == 1:
      dow += 1

    dow = dow % 7
    month_index += 1

  month_index %= 12
  year += 1

SAT = week_stat[5]
SUN = week_stat[6]
MON = week_stat[0]
TUE = week_stat[1]
WED = week_stat[2]
THU = week_stat[3]
FRI = week_stat[4]

print(f"{SAT} {SUN} {MON} {TUE} {WED} {THU} {FRI}\n")

  